//
//  UIButton+initialize.m
//  豆瓣KVC
//
//  Created by dllo on 9/9/15.
//  Copyright (c) 2015 King. All rights reserved.
//

#import "UIButton+initialize.h"

@implementation UIButton (initialize)

+ (UIButton *)buttonWithFrame:(CGRect)frame color:(UIColor *)buttonColor title:(NSString *)title type:(UIButtonType)buttonType target:(id)buttonTarget action:(SEL)buttonAction event:(UIControlEvents)buttonEvent cornerRadius:(CGFloat)radius
{
    UIButton *button = [UIButton buttonWithType:buttonType];
    button.frame = frame;
    [button setTitle:title forState:UIControlStateNormal];
    button.backgroundColor = buttonColor;
    [button addTarget:buttonTarget action:buttonAction forControlEvents:UIControlEventTouchUpInside];
    button.layer.cornerRadius = radius;
    return button;
}

+ (UIButton *)buttonWithColor:(UIColor *)buttonColor title:(NSString *)title type:(UIButtonType)buttonType frame:(CGRect)buttonFrame target:(id)buttonTarget action:(SEL)buttonAction event:(UIControlEvents)buttonEvent
{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button.frame = buttonFrame;
    button.backgroundColor = buttonColor;
    [button setTitle:title forState:UIControlStateNormal];
    [button addTarget:buttonTarget action:buttonAction forControlEvents:UIControlEventTouchUpInside];
    button.layer.cornerRadius = 10;
    button.layer.masksToBounds = YES;
    return button;
    
}

@end
